load("//bazel:mongo_src_rules.bzl", "mongo_cc_benchmark", "mongo_cc_library", "mongo_cc_test", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(glob(["*.h"]))

# Ideally, there should be no linking dependencies upon any other libraries, for `libstdx`.
# This library is a shim filling in for deficiencies in various standard library
# implementations.  There should never be any link-time dependencies into mongo internals.
mongo_cc_library(
    name = "stdx",
    srcs = [
        "set_terminate_internals.cpp",
    ],
)

mongo_cc_unit_test(
    name = "stdx_test",
    srcs = [
        "unordered_map_test.cpp",
    ],
    tags = [
        "mongo_unittest_third_group",
        "server-programmability",
    ],
    deps = [],
)

mongo_cc_unit_test(
    name = "sigaltstack_location_test",
    srcs = [
        "sigaltstack_location_test.cpp",
    ],
    has_custom_mainline = True,
    tags = ["mongo_unittest_second_group"],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_unit_test(
    name = "set_terminate_dispatch_test",
    srcs = [
        "set_terminate_dispatch_test.cpp",
    ],
    has_custom_mainline = True,
    tags = ["mongo_unittest_first_group"],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_unit_test(
    name = "set_terminate_from_main_die_in_thread_test",
    srcs = [
        "set_terminate_from_main_die_in_thread_test.cpp",
    ],
    has_custom_mainline = True,
    tags = ["mongo_unittest_seventh_group"],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_unit_test(
    name = "set_terminate_from_thread_die_in_main_test",
    srcs = [
        "set_terminate_from_thread_die_in_main_test.cpp",
    ],
    has_custom_mainline = True,
    tags = ["mongo_unittest_seventh_group"],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_unit_test(
    name = "set_terminate_from_thread_die_in_thread_test",
    srcs = [
        "set_terminate_from_thread_die_in_thread_test.cpp",
    ],
    has_custom_mainline = True,
    tags = ["mongo_unittest_sixth_group"],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_benchmark(
    name = "condition_variable_bm",
    srcs = [
        "condition_variable_bm.cpp",
    ],
    tags = ["first_half_bm"],
    deps = [
        "//src/mongo:base",
    ],
)
